<?php

/* @var $this yii\web\View */

$this->title = '首页 - '. Yii::$app->config->get('sys_site_name');
?>

<div class="home-slider">
    <ul id="homeSlider">
        <?php foreach ($ads as $ad): ?>
        <li><a href="<?=$ad['url']?>" style="background-image: url('/uploads/<?=\app\core\widgets\webuploader\Picture::getPic($ad['pic'])['path']?>');"></a></li>
        <?php endforeach; ?>
    </ul>
</div>
<!--/home-slider-->

<div class="box-main home-category mt-40">
    <div class="row">
        <?php foreach ($productCate as $v): ?>
        <div class="col-xs-12 col-md-4 item">
            <a href="<?=Yii::$app->urlManager->createUrl(['product/index', 'id'=>$v['id']])?>">
                <h5 class="text-center"><?=$v['name']?><span>系列</span></h5>
                <figure class="useThumb">
                    <img src="/uploads/<?=\app\core\widgets\webuploader\Picture::getPic($v['tui']['cover'])['path']?>" alt="" onerror="this.src='/uploads/empty.jpg'" class="img-responsive">
                </figure>
                <div class="btn-area text-center">
                    <span class="btn">浏览 <i class="fa fa-angle-right"></i></span>
                </div>
            </a>
        </div>
        <!---->
        <?php endforeach; ?>
    </div>
</div>
<!--/home-category-->

<div class="box-main home-news box-white mt-40">
    <ul class="tabs-blue">
        <?php foreach ($postCate as $k => $v): ?>
            <li <?php if ($k == 0) { echo 'class="active"'; } ?> ><a href="#newsType<?=$k?>" data-toggle="tab"><?=$v['name']?></a></li>
            <!--<li><a href="#newsType2" data-toggle="tab">企业快讯</a></li>-->
        <?php endforeach; ?>
    </ul>
    <!--/tabs-blue-->
    <div class="tab-content pa-15">
        <?php foreach ($postCate as $k => $v): ?>
        <div class="tab-pane <?php if ($k == 0) { echo 'active'; } ?>" id="newsType<?=$k?>">
            <div class="home-news-box">
                <div class="top-news">
                    <?php if (!empty($v['top'])): ?>
                        <a href="<?=Yii::$app->urlManager->createUrl(['post/view', 'id'=>$v['top']['id']])?>">
                            <figure class="useThumb">
                                <img src="/uploads/<?=\app\core\widgets\webuploader\Picture::getPic($v['top']['thumb'])['path']?>" alt="" onerror="this.src='/uploads/empty.jpg'" class="img-responsive">
                            </figure>
                            <div class="title">
                                <h5><?=$v['top']['title']?></h5>
                                <div class="con">
                                    <?=$v['top']['description']?>
                                </div>
                            </div>
                        </a>
                    <?php endif; ?>
                </div>
                <ul>
                    <?php foreach ($v['posts'] as $post): ?>
                        <li><a href="<?=Yii::$app->urlManager->createUrl(['post/view', 'id'=>$post['id']])?>"><?=$post['title']?></a></li>
                    <?php endforeach; ?>
                </ul>
            </div>
        </div>
        <!---->
        <?php endforeach; ?>
    </div>
    <!--/tab-content-->
</div>
<!--/home-news-->


<?=$this->render('../layouts/contact-form', ['mailForm' => $mailForm])?>
<?=$this->render('link', ['links' => $links])?>


